#include <iostream>
#include <algorithm>
using namespace std;

struct runner{
	int score;
	string name;
};
runner a[100];
bool cmpScore(runner x,runner y)
{
	return x.score>y.score;
}
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) 
	{
		cin>>a[i].name>>a[i].score;
	}
	sort(a,a+n,cmpScore);
	cout<<a[k-1].name<<endl;
	return 0;
}
